<%@page import="wt.httpgw.URLFactory"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="ext.acae2.document.helper.ECMDocHelper"%>
<%@ taglib uri="http://www.ptc.com/windchill/taglib/mvc" prefix="mvc"%>
<%@ taglib prefix="jcamvc" uri="http://www.ptc.com/windchill/taglib/jcaMvc"%>
<%@ taglib uri="http://www.ptc.com/windchill/taglib/fmt" prefix="fmt"%>
<%@ taglib uri="http://www.ptc.com/windchill/taglib/wrappers" prefix="wrap"%>
<%@ taglib uri="http://www.ptc.com/windchill/taglib/components" prefix="jca"%>	
<%@ taglib prefix="wctags" tagdir="/WEB-INF/tags"%>
<%@ include file="/netmarkets/jsp/util/begin.jspf"%>
<%@ include file="/netmarkets/jsp/components/standardAttributeConfigs.jspf"%>
<%@ page import="ext.acae2.document.resource.DocResource"%>

<fmt:setLocale value="${localeBean.locale}"/>
<fmt:setBundle basename="ext.acae2.document.resource.DocResource" />
<fmt:message var="ECM_SEARCH_TITLE" key="<%= DocResource.ECM_SEARCH_TITLE%>" />
<fmt:message var="ECM_SEARCH_CONDITION" key="<%= DocResource.ECM_SEARCH_CONDITION%>" />
<fmt:message var="ECM_SEARCH_START_TIME" key="<%= DocResource.ECM_SEARCH_START_TIME%>" />
<fmt:message var="ECM_SEARCH_END_TIME" key="<%= DocResource.ECM_SEARCH_END_TIME%>" />
<fmt:message var="ECM_SEARCH_BIANZHI_DEPT" key="<%= DocResource.ECM_SEARCH_BIANZHI_DEPT%>" />
<fmt:message var="ECM_SEARCH_RECEIVE_DEPT" key="<%= DocResource.ECM_SEARCH_RECEIVE_DEPT%>" />
<fmt:message var="ECM_SEARCH_BUTTON" key="<%= DocResource.ECM_SEARCH_BUTTON%>" />


<%
    List<String> departments = ECMDocHelper.getDepartments();
    List<String> deptCodes = new ArrayList<String>();
    List<String> selectValues = new ArrayList<String>();
    selectValues.add("");
    for(String department :departments ){
    	if(!"".equals(department)){
    		String deptCode = department.substring(0,department.indexOf("-"));
        	deptCodes.add(deptCode);
    	}else{
    		deptCodes.add("");
    	}
    }
    request.setAttribute("departments", departments);
    request.setAttribute("deptCodes", deptCodes);
    request.setAttribute("selectValues", selectValues);
    String serverName = request.getServerName();
    String contextPath = request.getContextPath();
    String scheme = request.getScheme();
    String fullPath = scheme+"://"+serverName+contextPath;
%>
<b>${ECM_SEARCH_TITLE }</b>
<fieldset class="x-fieldset x-form-label-left" id="
	Visualization_and_Attributes" >
	<legend>${ECM_SEARCH_CONDITION }</legend>
	<table style="width: 60%">
	    <tr>
	      <td width="15%">${ECM_SEARCH_START_TIME} : </td>
	      <td width="15%">
	      <input id="beginTime" type="text" name="null___beginTime_col_beginTime___textbox" onBlur="validateDate1(this, 'com.ptc.core.ui.componentRB.DATE_ERROR', 3, 2, 1, 'yyyy/MM/dd', true)" onkeypress="validateDate1ForEnterKey(event , this, 'com.ptc.core.ui.componentRB.DATE_ERROR', 3, 2, 1, 'yyyy/MM/dd', true)" value=""  size=10 maxlength=10/>
	      <a onclick="initCal('\u65e5\u5386', '<BASE HREF=<%=fullPath %>/><LINK REL=stylesheet HREF=netmarkets/css/siteStyles.css TYPE=text/css>', '<%=fullPath%>/templates/cadx/common/trlUtils.js', 3, 2, 1, '', '', false, 100, 1934); setDateField(PTC.Calendar.getDateInputField (this), 'yyyy/MM/dd', '\u4e00\u6708#\u4e8c\u6708#\u4e09\u6708#\u56db\u6708#\u4e94\u6708#\u516d\u6708#\u4e03\u6708#\u516b\u6708#\u4e5d\u6708#\u5341\u6708#\u5341\u4e00\u6708#\u5341\u4e8c\u6708#', '#', '\u661f\u671f\u65e5#\u661f\u671f\u4e00#\u661f\u671f\u4e8c#\u661f\u671f\u4e09#\u661f\u671f\u56db#\u661f\u671f\u4e94#\u661f\u671f\u516d#', '0'); newCalendarWindow(event, '<%=fullPath %>/netmarkets/jsp/util/calPopup.jsp', 'height=220,width=240')" onmousedown="suppressCalendarBlur(event);" href="javascript:void(0)">
            <img width="18" border="0" heigth="16" src="netmarkets/images/calendar.gif" name="calImg">
          </a>
         <font class="hlpTxt">yyyy/mm/dd</font>
	      
	     <!-- <wrap:dateInputComponent name="beginTime" id="beginTime"  dateValue="${paramBeginTime}" dateValueType="DATE_ONLY"></wrap:dateInputComponent>  -->
	      
	      </td>
	      <td>~&nbsp;&nbsp;&nbsp;&nbsp;</td>
	      <td width="15%">${ECM_SEARCH_END_TIME} : </td>
	      <td width="15%">
	      <!--<wrap:dateInputComponent name="endTime" id="endTime"  dateValue="${paramEndTime}" dateValueType="DATE_ONLY"></wrap:dateInputComponent>-->
	      <input id="endTime" type="text" name="null___endTime_col_endTime___textbox" onBlur="validateDate1(this, 'com.ptc.core.ui.componentRB.DATE_ERROR', 3, 2, 1, 'yyyy/MM/dd', true)" onkeypress="validateDate1ForEnterKey(event , this, 'com.ptc.core.ui.componentRB.DATE_ERROR', 3, 2, 1, 'yyyy/MM/dd', true)" value=""  size=10 maxlength=10/>
	      <a onclick="initCal('\u65e5\u5386', '<BASE HREF=<%=fullPath %>/><LINK REL=stylesheet HREF=netmarkets/css/siteStyles.css TYPE=text/css>', '<%=fullPath%>/templates/cadx/common/trlUtils.js', 3, 2, 1, '', '', false, 100, 1934); setDateField(PTC.Calendar.getDateInputField (this), 'yyyy/MM/dd', '\u4e00\u6708#\u4e8c\u6708#\u4e09\u6708#\u56db\u6708#\u4e94\u6708#\u516d\u6708#\u4e03\u6708#\u516b\u6708#\u4e5d\u6708#\u5341\u6708#\u5341\u4e00\u6708#\u5341\u4e8c\u6708#', '#', '\u661f\u671f\u65e5#\u661f\u671f\u4e00#\u661f\u671f\u4e8c#\u661f\u671f\u4e09#\u661f\u671f\u56db#\u661f\u671f\u4e94#\u661f\u671f\u516d#', '0'); newCalendarWindow(event, '<%=fullPath %>/netmarkets/jsp/util/calPopup.jsp', 'height=220,width=240')" onmousedown="suppressCalendarBlur(event);" href="javascript:void(0)">
            <img width="18" border="0" heigth="16" src="netmarkets/images/calendar.gif" name="calImg">
          </a>
         <font class="hlpTxt">yyyy/mm/dd</font>
	      </td>
	    </tr>
		<tr>
		  <td>${ECM_SEARCH_BIANZHI_DEPT} : </td>
		  <td><wrap:comboBox name="bianzhiDept" required="true" internalValues="${deptCodes}"  displayValues="${departments}" selectedValues="${selectValues }"/></td>
          <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          <td>${ECM_SEARCH_RECEIVE_DEPT} : </td>
		  <td><wrap:comboBox name="receiveDept" required="true" internalValues="${deptCodes}"  displayValues="${departments}" selectedValues="${selectValues }"/></td>
		</tr>
		<tr>
			<td colspan="6" align="right"><wrap:button name="search"
					value="${ECM_SEARCH_BUTTON }" onclick="submitDocSearch();" /></td>
		</tr>
	</table>
</fieldset>
<!--jcamvc:tableContainer compId="acae2.mvc.ECMRecommendTableBuilder" height="500" /-->

<jsp:include page="${mvc:getComponentURL('acae2.mvc.ECMRecommendTableBuilder')}" flush="true"/>


<%@ include file="/netmarkets/jsp/util/end.jspf"%>



<script language="javascript">
  function submitDocSearch(){
	  var a = PTC.jca.table.Utils.reload('ecm.replydoc.table', {}, true);
  }
</script>